package com.xiaochen.baidu.controller;

import com.xiaochen.baidu.service.IBaiduService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author xc
 * @date 2025/10/12/13:04
 * @desc
 */
@Slf4j
@RestController
@CrossOrigin("*")
@RequestMapping("/baidu")
public class BaiduController {
    
    @Resource
    private IBaiduService baiduService;
    
    @RequestMapping(value = "/save",method = RequestMethod.GET)
    public void save(String username, String password) {
        baiduService.save(username, password);
    }
    
    @RequestMapping(value = "/parse",method = RequestMethod.GET)
    public String parse(String url, String num) throws Exception {
        return baiduService.parse(url, num);
    }
}
